<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>修改姓名</title>
    <link rel="stylesheet" href="css/reset.css" />
    <link rel="stylesheet" href="css/all.css" />
    <script src="js/jquery-1.7.1.min.js"></script>
    <!--<script src="js/PIE.js"></script>-->
    <!--<script src="js/self.js"></script>-->
    <style>
        body{
            width: 100%;
            height: 100%;
            background: transparent;
        }
    </style>
</head>
<body ontouchstart="">

<div class="iframeBlock of bcf w100 h100">
    <div class="logintittle of tc pr jz">
        修改姓名<span class="pa cursor" id="close-x">&times;</span>
    </div>
    <div class="of jz" style="width: 90%;">
        <input type="text" name="" id="username" placeholder="原用户名：某某" class="db br3" disabled="disabled" style="margin-top: 30px;cursor: not-allowed"/>
        <p class="mgl10 cred f14"></p>
        <input type="text" name="" id="usernameNew" placeholder="新用户名" class="db br3"/>
        <p class="mgl10 cred f14"></p>
        <input type="password" name="" id="pwd" placeholder="密码" class="db br3" />
        <p class="mgl10 cred f14"></p>
        <div class="clearfix of" style="margin-top: 46px;">
            <button type="button" id="loginSub" class="cursor tc cf db w100" onclick="Sub();">修&nbsp;改</button>
        </div>
    </div>
</div>


<script>

    $(window).on("load", function() {
        $("#modifyNameBtn", parent.document).click(function () {
            $("#modifyNameIframeDiv", parent.document).slideDown();
            $(".theme-popover-mask", parent.document).fadeIn();

        })
        $("#close-x").click(function () {
            $("#modifyNameIframeDiv", parent.document).slideUp();
            $(".theme-popover-mask", parent.document).fadeOut();

        })
    })

    function Sub() {
        var usernameNew =$.trim($('#usernameNew').val());
        var pwd = $.trim($('#pwd').val());
        console.log(usernameNew);
        if(usernameNew == ""){
            $('#usernameNew').next('p').text('你还未填写新用户名');
            return false;
        }
        if(!(usernameNew =="")){
            $('#usernameNew').next('p').text(' ');
        }
        if(pwd == ""){
            $('#pwd').next('p').text('你还未填写密码');
            return false;
        }
        if(!(pwd == "")){
            $('#pwd').next('p').text(' ');
        }

        $.ajax({
            url: "",
            data: {usernameNew: usernameNew,pwd:pwd},
            type: 'post',
            dataType: 'json',
            beforeSend: function () {
                $("#loadingfDiv").fadeIn();
            },
            success: function (data) {
                console.log(data);
                if (data.code == 200) {
//                        alert("您的申请已提交,等待审核");
//                        alert(data.msg);
//                        window.location.reload();
//                        location.href = "withdraw.html";
                }else{
//                        alert(data.msg);
                    //window.history.back(-1);
                }
            },
            error: function (data) {
                alert(data.msg);
                return false;
            },
            complete: function () {
                $("#loadingfDiv").fadeOut();
                $("#close-x").trigger('click');
            }
        });
    }
</script>
</body>
</html>